#ifndef STATICFUNCTION_H
#define STATICFUNCTION_H

#include <QObject>


#pragma pack(1)

typedef struct _LIGHT_INFO
{
	QString color;
}LIGHT_INFO;

typedef struct _LIGHT_CONFIG
{
	QString name;
	int brightness1;
	int brightness2;
	int brightness3;
	int brightness4;
}LIGHT_CONFIG;

typedef struct _ACTION_CONFIG
{
	int id;
	int x;
	int y;
	int catchBall;
	//int catchPad;
	int catchCap;
	int catchSubstrate;
	//int catchCM;
}ACTION_CONFIG;

typedef struct _PACKAGE_INFO
{
	int hdVersion;
	//int crossMark;
	int ballNumbers;
	int capNumbers;
	int padNumbers;
	int multiErrorCode;
	double edgeGap;
	double innerGap;
	int brightBorder;
	double capArea;

	LIGHT_INFO lightAssist;
	LIGHT_INFO lightTop;
	LIGHT_INFO lightMid;
	LIGHT_INFO lightBottom;

	LIGHT_CONFIG lightConfigBall;
	LIGHT_CONFIG lightConfigCM;
	LIGHT_CONFIG lightConfigCap;
	LIGHT_CONFIG lightConfigSubstrate;

	QList<ACTION_CONFIG>listAction;

}PACKAGE_INFO;

typedef struct _RUN_INFO
{
	QString operatorName;
	QString packageName;
	QString productNum;
	QString lotName;
	int chipNum;
	bool bVarify;
	//bool bAnalyzeImage;
}RUN_INFO;
#pragma pack()

class StaticFunction : public QObject
{
    Q_OBJECT
public:
    explicit StaticFunction(QObject *parent = nullptr);
    static uint8_t Get1BytesFromBuf(uint8_t *pBuf, int index);
    static uint16_t Get2BytesFromBuf(uint8_t *pBuf, int index);
    static uint32_t Get4BytesFromBuf(uint8_t *pBuf, int index);
    static int32_t Getint32FromBuf(uint8_t *pBuf, int index);
    static int64_t GetNBytesFromBuf(uint8_t *pBuf, int index, int length);
	static PACKAGE_INFO GetPackageInfo();
	static PACKAGE_INFO GetPackageInfoFromFile();
	static void SavePackageInfo(PACKAGE_INFO info);
signals:

public slots:
};

#endif // STATICFUNCTION_H
